class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int n = 0;
        for (auto& e : nums)
        {
            n = n ^ e;
        }
        for (int i = 0; i <= nums.size(); i++)
        {
            n = n ^ i;
        }
        return n;
    }
};
